<template>
	<view>
		<z-paging ref="paging" :refresher-enabled="false">
			<view class="swiper_box">
				<tn-swiper @change="swsiperChange" :list="swiperList" :autoplay="true" :current="swipercurrent"
					effect3dPreviousSpacing="230" height="372" radius="0"></tn-swiper>
				<view class="gg_box">
					<tn-notice-bar :list="list" mode="horizontal" :circular="false" fontColor="red"></tn-notice-bar>
				</view>
			</view>
			<view class="content_box">
				<view class="hd_box">
					<view class="dange_hd_box" v-for="(item, index) in hdList" :key="index" @click="go(item)">
						<view class="top_icon_box">
							<image :src="item.img" />
						</view>
						<view class="text_box">{{ item.text }}</view>
					</view>
				</view>
				<view class="line"></view>
				<view class="zxhg_box">
					<view class="bt_box">
						<view class="left_box">最新换购</view>
						<view class="right_box" @click="$router('/redemption/index')">
							<view class="gengduo_box">更多</view>
							<view class="icon_you_box"></view>
						</view>
					</view>
					<view class="main_box">
						<view class="dange_sp_box" v-for="(item, index) in spLIst.slice(0, 2)" :key="index">
							<view class="top_img">
								<image class="" :src="item.image" />
							</view>
							<view class="name_box slh">{{ item.title }}</view>
							<view class="price_box">
								<text style="margin-right: 30rpx;">{{ item.integral * 1 }}积分</text>
								<text style="text-decoration:line-through; opacity: .7;">￥{{ item.price * 1 }}</text>
							</view>
							<view class="ys_box">已售{{ item.sales }}份</view>
							<view class="dh_box" @click="$router('/redemption/dh?id=' + item.id)">兑换</view>
						</view>
					</view>
				</view>
			</view>
			<view class="bottom">
				<view class="bt_box">
					<view class="left_box">最新活动</view>
					<view class="right_box">
					</view>
				</view>
				<view class="tupian_box" v-for="(item,index) in ActivList" :key="index">
					<view class="xw_box_img">
						<image class="" :src="item.image" mode="widthFix" />
					</view>
					<view class="wzjs_box">
						<tn-notice-bar :leftIcon="false" speed='40' :list="[item.content]" mode="horizontal"
							color="#FFFFFF"></tn-notice-bar>
					</view>
				</view>
			</view>
		</z-paging>
	</view>

</template>

<script>
	export default {
		components: {},
		data() {
			return {
				swiperList: [], //轮播
				list: [
					'云樵餐厅！',
					'云樵餐厅！',
					'云樵餐厅！',
					'云樵餐厅！',
					'云樵餐厅！',
					'云樵餐厅！',
				],
				hdList: [{
						id: '1',
						img: 'https://image.dingxians.cn/image/2025-09-15/165824451.jpg',
						text: '积分兑换'
					},
					{
						id: '2',
						img: 'https://image.dingxians.cn/image/2025-09-15/165826221.jpg',
						text: '幸运转盘'
					}
				],
				spLIst: [

				],
				bannersLIst: [],
				ActivList: [],
			};
		},
		onLoad(e) {

		},
		onShow() {
			this.getList()
			this.getBanner()
			this.getordersActiv()
		},
		methods: {
			go(item) {
				if (item.id == 1) {
					this.$router('/redemption/index')
				} else {
					this.$router('/zp/index')
				}
			},
			getList() {
				this.$Request.get(this.$api.index.goods).then(res => {
					this.spLIst = res.data.data
				})
			},
			getBanner() {
				this.$Request.get(this.$api.index.banners).then(res => {
					this.swiperList = res.data
				})
			},
			getordersActiv() {
				this.$Request.post(this.$api.index.ordersActivityList).then(res => {
					this.ActivList = res.data.data
				})
			}
		}
	};
</script>

<style lang="scss" scoped>
	/deep/.zp-scroll-view-absolute {
		background-image: none !important;
		background-color: #fff !important;
	}

	/deep/.tn-row-notice-class {
		padding: 0 !important;
		height: 60rpx !important;
		line-height: 60rpx !important;
	}

	.swiper_box {
		width: 750rpx;
		height: 372rpx;
		position: relative;

		.gg_box {
			width: 750rpx;
			height: 60rpx;
			background-color: #fff;
			border-radius: 30rpx 30rpx 0 0;
			position: absolute;
			bottom: 0;
			left: 0;
			right: 0;
			margin: auto;
		}
	}

	.content_box {
		width: 750rpx;
		min-height: 700rpx;
		background-color: #fff;
		margin: auto;

		.hd_box {
			width: 100%;
			height: 180rpx;
			display: flex;
			justify-content: space-around;
			align-items: center;
			margin-bottom: 20rpx;

			.dange_hd_box {
				width: 200rpx;
				height: 100%;

				.top_icon_box {
					width: 100rpx;
					height: 100rpx;
					margin: 20rpx auto;

					image {
						width: 100rpx;
						height: 100rpx;
					}
				}

				.text_box {
					width: 100%;
					height: 50rpx;
					line-height: 50rpx;
					text-align: center;
					color: #333;
					font-size: 30rpx;
					font-family: text1;
				}
			}
		}

		.line {
			width: 580rpx;
			height: 1rpx;
			background-color: #FAF9FA;
			margin: auto;
		}

		.zxhg_box {
			width: 100%;
			height: 400rpx;

			.bt_box {
				width: 100%;
				height: 80rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				box-sizing: border-box;
				padding: 0 20rpx;

				.left_box {
					color: #000;
					font-size: 24rpx;

				}

				.right_box {
					width: auto;
					display: flex;
					justify-content: flex-end;
					align-items: center;

					.gengduo_box {
						color: #000;
						font-size: 24rpx;

					}

					.icon_you_box {
						width: 24rpx;
						height: 24rpx;
						background-image: url('https://image.dingxians.cn/image/2025-09-15/165398803.png');
						background-size: 100% 100%;
					}

				}
			}

			.main_box {
				width: 100%;
				height: 400rpx;
				display: flex;
				justify-content: center;

				.dange_sp_box {
					position: relative;
					width: 260rpx;
					height: 400rpx;
					background-color: #f0f0f0;
					border-radius: 30rpx;
					margin: 0 50rpx;

					.top_img {
						width: 100%;
						height: 260rpx;
						border-radius: 30rpx 30rpx 0 0;

						image {
							width: 100%;
							height: 260rpx;
							border-radius: 30rpx 30rpx 0 0;
						}
					}
				}

				.name_box {
					width: 80%;
					height: 40rpx;
					line-height: 40rpx;
					font-size: 24rpx;
					color: #000;
					margin: auto;
					font-weight: 600;
					margin-bottom: 10rpx;
				}

				.price_box {
					width: 80%;
					height: 40rpx;
					line-height: 40rpx;
					font-size: 24rpx;
					color: red;
					margin: auto;
					font-weight: 600;
					margin-bottom: 24rpx;
				}

				.ys_box {
					width: 80%;
					height: 20rpx;
					font-size: 20rpx;
					line-height: 20rpx;
					color: #bbb;
					margin: auto;
				}

				.dh_box {
					width: 80rpx;
					height: 40rpx;
					line-height: 40rpx;
					background-color: #f64b43;
					color: #fff;
					text-align: center;
					position: absolute;
					bottom: 20rpx;
					right: 10rpx;
					border-radius: 10rpx;
				}
			}
		}
	}

	.bottom {
		width: 100%;
		background-color: #fff;
		margin-top: 30rpx;

		.bt_box {
			width: 100%;
			height: 80rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			box-sizing: border-box;
			padding: 0 20rpx;

			.left_box {
				color: #000;
				font-size: 24rpx;

			}

			.right_box {
				width: auto;
				display: flex;
				justify-content: flex-end;
				align-items: center;

				.gengduo_box {}

				.icon_you_box {}

			}
		}

		.tupian_box {
			width: 80%;
			background-color: #f0f0f0;
			margin: auto;
			margin-bottom: 20rpx;

			.xw_box_img {
				width: 100%;

				image {
					width: 100%;
				}
			}

			.wzjs_box {
				width: 100%;
				height: 60rpx;
				line-height: 60rpx;
				font-size: 30rpx;
				color: #333;

			}
		}
	}
</style>